package com.sgolub.commanndsonline.ws;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.context.support.SpringBeanAutowiringSupport;

import com.sgolub.commanndsonline.ws.entity.AdvertisingRegistryItem;
import com.sgolub.commanndsonline.ws.entity.AdvertisingRegistryOperation;
import com.sgolub.commanndsonline.ws.entity.ResultEntity;
import com.sgolub.commanndsonline.ws.service.AdvertisingRegistryItemService;
import com.sgolub.commanndsonline.ws.service.AdvertisingRegistryOperationService;


public class ImportADVWebService extends SpringBeanAutowiringSupport {

	//DI via Spring Framework
	@Autowired 
		AdvertisingRegistryItemService advertisingRegistryItemService;

	@Autowired 
	AdvertisingRegistryOperationService advertisingRegistryOperationService;	
		
		public ResultEntity uploadAdvertisingRegistryItem(AdvertisingRegistryItem item){
			
			System.out.println("Operation =uploadAdvertisingRegistryItem= succeded!!!");
			System.out.println(item.toString());
			
			advertisingRegistryItemService.add(item);
			
			return new ResultEntity(200,"Operation =uploadAdvertisingRegistryItem= succeded!!!");
		}
		
		
		public ResultEntity uploadAdvertisingRegistryOperation(AdvertisingRegistryOperation operation){
			System.out.println("Operation =uploadAdvertisingRegistryOperation= succeded!!!");
			System.out.println(operation.toString());
			
			advertisingRegistryOperationService.add(operation);
			
			return new ResultEntity(200,"Operation =uploadAdvertisingRegistryOperation= succeded!!!");
		}
		
		public String pingServer(){
			System.out.println("Operation =pingServer= succeded!!!");

			return "Hello from Advertising WEB-Service";
		}
	
}
